package cn.jinjimi.app.main.fragment;

import android.content.Intent;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;

import cn.jinjimi.base.Task.TaskExecutor;
import cn.jinjimi.app.R;
import cn.jinjimi.app.main.activity.MainActivity;
import cn.jinjimi.app.main.extend.BaseFragment;

;

/**
 *
 * @author HANER
 * @date 15/4/12
 */
public class StartFragment extends BaseFragment {

    @Override
    protected int getLayoutResourceId() {
        return R.layout.fragment_start;
    }

    @Override
    protected void initial() {
        initData();
    }

    protected void initData() {
        FragmentManager fm = getActivity().getSupportFragmentManager();
        final FragmentTransaction ft = fm.beginTransaction();
        TaskExecutor.scheduleTaskOnUiThread(1000, new Runnable() {
            @Override
            public void run() {
                if (checkActivityExit()) {
                    return;
                }
                Intent intent = new Intent(getActivity(), MainActivity.class);
                startActivity(intent);
                getActivity().finish();
            }
        });
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        System.gc();
    }
}
